<?php


Route::group(['middleware' => ['web', 'admin'], 'domain' => env('ADMIN_HOST', ''), 'namespace' => 'Modules\Admin\Http\Controllers'], function () {

    Route::get('test',function (){
        $a = predis_hash_get('aa','bb');
        if(is_null($a)){
            predis_hash_set('aa','bb','吴蒙蒙');
            dd('吴');
        }
        dd($a);
        $a = \Illuminate\Support\Facades\DB::table('vv_user')->get();
        dd($a);
    });//富文本页面测试


    /* 无需登录 + 无需权限路由 */
    Route::post('admin-rich_text_upload', ['as' => 'admin_rich_text_upload', 'uses' => 'IndexController@rich_text_upload']);//添加富文本测试
    Route::get('admin-rich_text', ['as' => 'admin_rich_text', 'uses' => 'IndexController@rich_text']);//富文本页面测试
    Route::get('admin-file_upload', ['as' => 'admin_file_upload', 'uses' => 'IndexController@file_upload']);//测试文件上传-页面
    Route::post('admin-element_upload_file', ['as' => 'admin_element_upload_file', 'uses' => 'IndexController@element_upload_file']);//测试文件上传-操作
    Route::get('admin-index-clear-cache', ['as' => 'admin_index_clear_cache', 'uses' => 'IndexController@clearCache']);//清除缓存页面
    Route::delete('admin-index-clear-operation', ['as' => 'admin_index_clear_cache_operation', 'uses' => 'IndexController@clearCacheOperation']);//清除缓存操作
    Route::post('admin-upload-img', ['as' => 'admin_upload_img', 'uses' => 'PublicController@uploadImg']); //图片上传
    Route::post('admin-upload-file', ['as' => 'admin_upload_file', 'uses' => 'PublicController@uploadFile']);
    Route::get('admin-province', ['as' => 'admin_province', 'uses' => 'PublicController@getProvinceList']);//省列表
    Route::post('admin-get-list', ['as' => 'admin_get_list', 'uses' => 'PublicController@getList']);//城市-区县列表
    Route::get('admin-logistics-tracking', ['as' => 'admin_logistics_tracking', 'uses' => 'PublicController@logisticsTracking']);//物流追踪
    Route::get('admin-unicode', ['as' => 'admin_unicode', 'uses' => 'IndexController@unicode']);//字体图标
    Route::get('admin-tips', ['as' => 'admin_tips', 'uses' => 'IndexController@tips']);//说明
    Route::get('admin_finance_graphs', ['as' => 'admin_finance_graphs', 'uses' => 'IndexController@finance_graphs']);//财务图表统计

    /* 无需权限 + 判断是否已登录，登录直接跳转到主页 */
    Route::group(['middleware' => 'admin_has_logined'], function () {
        //登录 登录操作
        Route::get('admin-login', ['as' => 'admin_login', 'uses' => 'IndexController@login']);//登录页面
        Route::put('admin-login-in', ['as' => 'admin_login_in', 'uses' => 'IndexController@loginIn']);//登录操作
    });

    /* 无需权限 + 判断是否已登录，未登录直接跳转到登录页面 */
    Route::group(['middleware' => ['admin_is_login']], function () {
        Route::get('/', ['as' => 'admin_index', 'uses' => 'IndexController@main']);//主页页面
//        Route::get('admin-check_menu', ['as' => 'admin-check_menu', 'uses' => 'IndexController@check_menu']);//根据头部菜单检测左侧菜单
        Route::get('admin-welcome', ['as' => 'admin-welcome', 'uses' => 'IndexController@welcome']);//欢迎页面
        Route::get('admin-login-out', ['as' => 'admin_login_out', 'uses' => 'IndexController@loginOut']);//退出登录
    });

    /* 判断权限 + 判断是否已登录，未登录直接跳转到登录页面 */

    //    Route::group(['middleware' => ['is_login', 'admin_is_auth','admin_action_log']], function () {
    Route::group(['middleware' => ['admin_is_login', 'admin_is_auth', 'admin_action_log']], function () {

        //权限管理
        Route::get('admin-permission-index', ['as' => 'admin_permission_index', 'uses' => 'PermissionController@index']);//权限列表
//        Route::get('admin-permission-create', ['as' => 'admin_permission_create',  'uses' => 'PermissionController@create']);//添加权限页面
        Route::post('admin-permission-store', ['as' => 'admin_permission_store', 'uses' => 'PermissionController@store']);//添加权限操作
//        Route::get('admin-permission-edit', ['as' => 'admin_permission_edit',  'uses' => 'PermissionController@edit']);//修改权限页面
        Route::put('admin-permission-update', ['as' => 'admin_permission_update', 'uses' => 'PermissionController@update']);//修改权限操作
//        Route::put('admin-permission-change_state', ['as' => 'admin_permission_change_state', 'uses' => 'PermissionController@change_state']);//修改权限状态操作
//        Route::put('admin-permission-change_menu', ['as' => 'admin_permission_change_menu', 'uses' => 'PermissionController@change_menu']);//修改权限菜单状态操作
        Route::delete('admin-permission-delete', ['as' => 'admin_permission_delete', 'uses' => 'PermissionController@delete']);//删除权限操作
        Route::post('admin-permission-drag_move_node', ['as' => 'admin_permission_drag_move_node', 'uses' => 'PermissionController@drag_move_node']);//拖拽移动权限操作

        //角色管理
        Route::get('admin-role-index', ['as' => 'admin_role_index', 'uses' => 'RoleController@index']);//角色列表
        Route::get('admin-role-create', ['as' => 'admin_role_create', 'uses' => 'RoleController@create']);//添加角色页面
        Route::post('admin-role-store', ['as' => 'admin_role_store', 'uses' => 'RoleController@store']);//添加角色操作
        Route::get('admin-role-edit', ['as' => 'admin_role_edit', 'uses' => 'RoleController@edit']);//修改角色页面
        Route::put('admin-role-update', ['as' => 'admin_role_update', 'uses' => 'RoleController@update']);//修改角色操作
        Route::put('admin-role-change_state', ['as' => 'admin_role_change_state', 'uses' => 'RoleController@change_state']);//修改权限状态操作
        Route::delete('admin-role-delete', ['as' => 'admin_role_delete', 'uses' => 'RoleController@delete']);//删除角色操作
        Route::get('admin-role-permission-edit', ['as' => 'admin_role_permission_edit', 'uses' => 'RoleController@rolePermissionEdit']);//角色权限设置页面
        Route::put('admin-role-permission-update', ['as' => 'admin_role_permission_update', 'uses' => 'RoleController@rolePermissionUpdate']);//角色权限设置操作

        //管理员管理
        Route::get('admin-admin-index', ['as' => 'admin_admin_index', 'uses' => 'AdminsController@index']);//管理员列表
        Route::get('admin-admin-create', ['as' => 'admin_admin_create', 'uses' => 'AdminsController@create']);//添加管理员页面
        Route::post('admin-admin-store', ['as' => 'admin_admin_store', 'uses' => 'AdminsController@store']);//添加管理员操作
        Route::get('admin-admin-edit', ['as' => 'admin_admin_edit', 'uses' => 'AdminsController@edit']);//修改管理员页面
        Route::put('admin-admin-update', ['as' => 'admin_admin_update', 'uses' => 'AdminsController@update']);//修改管理员操作
        Route::put('admin-admin-change_state', ['as' => 'admin_admin_change_state', 'uses' => 'AdminsController@change_state']);//修改管理员状态操作
        Route::delete('admin-admin-delete', ['as' => 'admin_admin_delete', 'uses' => 'AdminsController@delete']);//删除管理员操作

        //日志管理
        Route::get('admin-log-action-log', ['as' => 'admin_log_action_log', 'uses' => 'IndexController@actionLog']);//操作日志
        Route::get('admin-log-login-log', ['as' => 'admin_log_login_log', 'uses' => 'IndexController@loginLog']);//登录日志
        Route::get('admin-log-sms-log', ['as' => 'admin_log_sms_log', 'uses' => 'IndexController@SmsLog']);//短信日志
        Route::get('admin-log-message-log', ['as' => 'admin_log_message_log', 'uses' => 'IndexController@messageLog']);//系统消息日志
        Route::get('admin-log-jpush-log', ['as' => 'admin_log_jpush_log', 'uses' => 'IndexController@jpush_list_log']);//极光推送消息日志


        require_once __DIR__ . '/temp_route/wu_route.php';
        require_once __DIR__ . '/temp_route/huqin_route.php';
        require_once __DIR__ . '/temp_route/yangxiaodong_route.php';
    });

    //////未登录用户跳转   end

});
